package com.share.domain.strategy.service.rule.tree.factory;

import com.share.domain.strategy.model.vo.RuleLogicCheckTypeVo;
import com.share.domain.strategy.model.vo.RuleTreeVo;
import com.share.domain.strategy.service.rule.tree.ILogicTreeNode;
import com.share.domain.strategy.service.rule.tree.factory.engine.IDecisionTreeEngine;
import com.share.domain.strategy.service.rule.tree.factory.engine.impl.DecisionTreeEngine;
import lombok.*;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 规则树工厂
 */
@Service
public class DefaultTreeFactory {
    private final Map<String, ILogicTreeNode> logicTreeNodeGroup;

    public DefaultTreeFactory(Map<String, ILogicTreeNode> logicTreeNodeGroup) {
        this.logicTreeNodeGroup = logicTreeNodeGroup;
    }

    public IDecisionTreeEngine openLogicTree(RuleTreeVo ruleTreeVo){
        return new DecisionTreeEngine(logicTreeNodeGroup,ruleTreeVo);
    }

//    @Data
//    @AllArgsConstructor
//    @NoArgsConstructor
//    @Builder
//    public static class strategyAwardVo{
//        private Integer awardId;
//        /** 抽奖奖品规则 */
//        private String awardRuleValue;
//    }

    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    @Data
    public static class TreeActionEntity{
        private RuleLogicCheckTypeVo ruleLogicCheckType;
        private StrategyAwardVo strategyAwardVo;
    }

    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    @Data
    public static class StrategyAwardVo {
        private Integer awardId;
        private String awardRuleValue;

    }
}
